package com.ruoyi.applet.service.impl;

import com.ruoyi.applet.domain.AppletImg;
import com.ruoyi.applet.mapper.AppletImgMapper;
import com.ruoyi.applet.service.IAppletImgService;
import com.brisk.common.utils.DateUtils;
import com.brisk.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * appletImgService业务层处理
 *
 * @author PENGFEIDENG
 * @date 2022-05-30
 */
@Service
public class AppletImgServiceImpl implements IAppletImgService {
    @Autowired
    private AppletImgMapper appletImgMapper;

    /**
     * 查询appletImg
     *
     * @param imgId appletImg主键
     * @return appletImg
     */
    @Override
    public AppletImg selectAppletImgByImgId(Long imgId) {
        return appletImgMapper.selectAppletImgByImgId(imgId);
    }

    /**
     * 查询appletImg列表
     *
     * @param appletImg appletImg
     * @return appletImg
     */
    @Override
    public List<AppletImg> selectAppletImgList(AppletImg appletImg) {
        return appletImgMapper.selectAppletImgList(appletImg);
    }

    /**
     * 新增appletImg
     *
     * @param appletImg appletImg
     * @return 结果
     */
    @Override
    public int insertAppletImg(AppletImg appletImg) {
        appletImg.setCreateTime(DateUtils.getNowDate());
        appletImg.setCreateBy(SecurityUtils.getUsername());
        return appletImgMapper.insertAppletImg(appletImg);
    }

    /**
     * 修改appletImg
     *
     * @param appletImg appletImg
     * @return 结果
     */
    @Override
    public int updateAppletImg(AppletImg appletImg) {
        appletImg.setUpdateTime(DateUtils.getNowDate());
        appletImg.setUpdateBy(SecurityUtils.getUsername());
        return appletImgMapper.updateAppletImg(appletImg);
    }

    /**
     * 批量删除appletImg
     *
     * @param imgIds 需要删除的appletImg主键
     * @return 结果
     */
    @Override
    public int deleteAppletImgByImgIds(Long[] imgIds) {
        return appletImgMapper.deleteAppletImgByImgIds(imgIds);
    }

    /**
     * 删除appletImg信息
     *
     * @param imgId appletImg主键
     * @return 结果
     */
    @Override
    public int deleteAppletImgByImgId(Long imgId) {
        return appletImgMapper.deleteAppletImgByImgId(imgId);
    }
}
